package com.tencent.sr.iris.basic.mp.restapi.controller.activity;

import com.tencent.sr.iris.activity.interfaces.request.acticity.UserOpenAppRequest;
import com.tencent.sr.iris.basic.mp.service.activity.UserEventReportService;
import com.tencent.sr.rmall.common.primitive.HttpResult;
import com.tencent.sr.rmall.springbootstarter.authtoken.localbean.AppUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@Api(tags = "活动-用户事件上报接口", value = "活动-用户事件上报接口")
@RestController
@RequestMapping("/iris/basic/mp/v1/user/event")
public class UserEventReportController {

    @Resource
    private AppUser appUser;
    @Resource
    private UserEventReportService userEventReportService;

    @PostMapping("userOpenApp")
    @ApiOperation("用户打开小程序上报")
    public HttpResult<Boolean> userOpenApp() {
        String uid = appUser.getUid();
        UserOpenAppRequest req = UserOpenAppRequest.builder().uid(uid).build();
        return userEventReportService.userOpenApp(req);
    }
}
